package codingforgreat.class10;

public class Class01_JumpGame {
    public static int jump(int[] arr) {
        if (arr == null || arr.length == 0) {
            return 0;
        }
        int step = 0;
        int cur = 0;
        int next = 0;
        for (int i = 0; i < arr.length; i++) {
            if(i > cur){
                step++;
                cur = next;
            }
                next = Math.max(next, i + arr[i]);

        }
        return step;
    }
}
